package xyz.mumuwei.youthcourseserver.utils;

import java.util.regex.Pattern;

/**
 * @author mumuwei
 * @date 2022/2/22
 */
public class RegexUtil {

    /**
     * 手机号校验
     */
    public static boolean phone(String phone) {
        return Pattern.matches("^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$", phone);
    }

    /**
     * 邮箱校验
     */
    public static boolean emali(String emali) {
        return Pattern.matches("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,})$", emali);
    }
}
